<?php

class IndexAction extends Action {

    public function index() {
        $Class = M('Class');
        $list = $Class->select();
        $this->assign('list', $list);
        $this->display();
    }

    public function insert() {
        $Class = M("Class");
        $Class->create();
//        $data['classname'] = '分类名称1';
//        $data['parentid'] = 0;
//        $data['rank'] = 1;
//        $data['status'] = 0;
//        $data['modelid'] = 1;
//        $list = $Class->add($data);
        $list = $Class->add();
        if ($list !== FALSE) {
            $this->success("添加成功","/");
        } else {
            $this->success($list);
        }
    }

}

?>
